import { http } from "@/utils/http";

export type ResultType = ReplaceTargetType<any[]>;

export const getList = (current, size, params) => {
  return http.request({
    url: "/cupSystemApi/dept/list",
    method: "get",
    params: {
      ...params,
      current,
      size,
    },
  });
};

export const getDictionary = (params) => {
  return http.request<any>({
    url: "/cupSystemApi/dict-biz/dictionary",
    method: "get",
    params,
  });
};

export const remove = (ids) => {
  return http.request({
    url: "/cupSystemApi/dept/remove",
    method: "post",
    params: {
      ids,
    },
  });
};

export const add = (row) => {
  return http.request({
    url: "/cupSystemApi/dept/submit",
    method: "post",
    data: row,
  });
};

export const update = (row) => {
  return http.request({
    url: "/cupSystemApi/dept/submit",
    method: "post",
    data: row,
  });
};

export const getDept = (id) => {
  return http.request({
    url: "/cupSystemApi/dept/detail",
    method: "get",
    params: {
      id,
    },
  });
};
export const getDeptTree = () => {
  return http.request<any>({
    url: "/cupSystemApi/dept/tree",
    method: "get",
  });
};
